<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: faiss::ProductQuantizer Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Faiss
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacefaiss.html">faiss</a></li><li class="navelem"><a class="el" href="structfaiss_1_1ProductQuantizer.html">ProductQuantizer</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="structfaiss_1_1ProductQuantizer-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">faiss::ProductQuantizer Struct Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="ProductQuantizer_8h_source.html">ProductQuantizer.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer_1_1PQDecoder16.html">PQDecoder16</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer_1_1PQDecoder8.html">PQDecoder8</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer_1_1PQDecoderGeneric.html">PQDecoderGeneric</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer_1_1PQEncoder16.html">PQEncoder16</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer_1_1PQEncoder8.html">PQEncoder8</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer_1_1PQEncoderGeneric.html">PQEncoderGeneric</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:a3a41c6286095e731be744548d9535a35"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">train_type_t</a> { <br/>
&#160;&#160;<b>Train_default</b>, 
<a class="el" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0">Train_hot_start</a>, 
<a class="el" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d">Train_shared</a>, 
<a class="el" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e">Train_hypercube</a>, 
<br/>
&#160;&#160;<a class="el" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931">Train_hypercube_pca</a>
<br/>
 }</td></tr>
<tr class="memdesc:a3a41c6286095e731be744548d9535a35"><td class="mdescLeft">&#160;</td><td class="mdescRight">initialization  <a href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">More...</a><br/></td></tr>
<tr class="separator:a3a41c6286095e731be744548d9535a35"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb18ebfbb52f3b73bf2d90e64e951285"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afb18ebfbb52f3b73bf2d90e64e951285"></a>
using&#160;</td><td class="memItemRight" valign="bottom"><b>idx_t</b> = <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">Index::idx_t</a></td></tr>
<tr class="separator:afb18ebfbb52f3b73bf2d90e64e951285"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a4f0f33c011dffe633a1748a48a082c22"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4f0f33c011dffe633a1748a48a082c22"></a>
float *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a4f0f33c011dffe633a1748a48a082c22">get_centroids</a> (size_t m, size_t i)</td></tr>
<tr class="memdesc:a4f0f33c011dffe633a1748a48a082c22"><td class="mdescLeft">&#160;</td><td class="mdescRight">return the centroids associated with subvector m <br/></td></tr>
<tr class="separator:a4f0f33c011dffe633a1748a48a082c22"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a74ac853e2e3a1451ca8a3d1d0fc9eea0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a74ac853e2e3a1451ca8a3d1d0fc9eea0"></a>
const float *&#160;</td><td class="memItemRight" valign="bottom"><b>get_centroids</b> (size_t m, size_t i) const </td></tr>
<tr class="separator:a74ac853e2e3a1451ca8a3d1d0fc9eea0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acebe865c544923e528ef7001aff372fd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acebe865c544923e528ef7001aff372fd"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>train</b> (int n, const float *x)</td></tr>
<tr class="separator:acebe865c544923e528ef7001aff372fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4722cff4131366b124d0a39e934d1460"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4722cff4131366b124d0a39e934d1460"></a>
&#160;</td><td class="memItemRight" valign="bottom"><b>ProductQuantizer</b> (size_t <a class="el" href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695">d</a>, size_t <a class="el" href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41">M</a>, size_t <a class="el" href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5">nbits</a>)</td></tr>
<tr class="separator:a4722cff4131366b124d0a39e934d1460"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3067f333b26811537a8519fb08292ce"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab3067f333b26811537a8519fb08292ce"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#ab3067f333b26811537a8519fb08292ce">set_derived_values</a> ()</td></tr>
<tr class="memdesc:ab3067f333b26811537a8519fb08292ce"><td class="mdescLeft">&#160;</td><td class="mdescRight">compute derived values when d, M and nbits have been set <br/></td></tr>
<tr class="separator:ab3067f333b26811537a8519fb08292ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad291f113c6d44a634ddc1972f9a3c775"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad291f113c6d44a634ddc1972f9a3c775"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#ad291f113c6d44a634ddc1972f9a3c775">set_params</a> (const float *<a class="el" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a>, int m)</td></tr>
<tr class="memdesc:ad291f113c6d44a634ddc1972f9a3c775"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define the centroids for subquantizer m. <br/></td></tr>
<tr class="separator:ad291f113c6d44a634ddc1972f9a3c775"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a08b130e3a21f2699a4e3bbec121fb838"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a08b130e3a21f2699a4e3bbec121fb838"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a08b130e3a21f2699a4e3bbec121fb838">compute_code</a> (const float *x, uint8_t *code) const </td></tr>
<tr class="memdesc:a08b130e3a21f2699a4e3bbec121fb838"><td class="mdescLeft">&#160;</td><td class="mdescRight">Quantize one vector with the product quantizer. <br/></td></tr>
<tr class="separator:a08b130e3a21f2699a4e3bbec121fb838"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae5a340ee5a4b1d35a565b167de2a2ef1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae5a340ee5a4b1d35a565b167de2a2ef1"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#ae5a340ee5a4b1d35a565b167de2a2ef1">compute_codes</a> (const float *x, uint8_t *codes, size_t n) const </td></tr>
<tr class="memdesc:ae5a340ee5a4b1d35a565b167de2a2ef1"><td class="mdescLeft">&#160;</td><td class="mdescRight">same as compute_code for several vectors <br/></td></tr>
<tr class="separator:ae5a340ee5a4b1d35a565b167de2a2ef1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aecd05d180799f3956065b0c5c54fd406"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#aecd05d180799f3956065b0c5c54fd406">compute_codes_with_assign_index</a> (const float *x, uint8_t *codes, size_t n)</td></tr>
<tr class="separator:aecd05d180799f3956065b0c5c54fd406"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7afbf9d96276f021981e99f064254208"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7afbf9d96276f021981e99f064254208"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a7afbf9d96276f021981e99f064254208">decode</a> (const uint8_t *code, float *x) const </td></tr>
<tr class="memdesc:a7afbf9d96276f021981e99f064254208"><td class="mdescLeft">&#160;</td><td class="mdescRight">decode a vector from a given code (or n vectors if third argument) <br/></td></tr>
<tr class="separator:a7afbf9d96276f021981e99f064254208"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a85ff52320b7536781d9021c88dc8b1b0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a85ff52320b7536781d9021c88dc8b1b0"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>decode</b> (const uint8_t *code, float *x, size_t n) const </td></tr>
<tr class="separator:a85ff52320b7536781d9021c88dc8b1b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95060fedd7c09eb20e968fd2fdb4b316"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a95060fedd7c09eb20e968fd2fdb4b316">compute_code_from_distance_table</a> (const float *tab, uint8_t *code) const </td></tr>
<tr class="separator:a95060fedd7c09eb20e968fd2fdb4b316"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a36361f41bcd2fa698f3c39eb7111ed09"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a36361f41bcd2fa698f3c39eb7111ed09">compute_distance_table</a> (const float *x, float *dis_table) const </td></tr>
<tr class="separator:a36361f41bcd2fa698f3c39eb7111ed09"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd5ae63b99f55418d2dc6298de72ca08"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acd5ae63b99f55418d2dc6298de72ca08"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>compute_inner_prod_table</b> (const float *x, float *dis_table) const </td></tr>
<tr class="separator:acd5ae63b99f55418d2dc6298de72ca08"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3521b9a36c28219fd6180cc7a9ce8207"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a3521b9a36c28219fd6180cc7a9ce8207">compute_distance_tables</a> (size_t nx, const float *x, float *dis_tables) const </td></tr>
<tr class="separator:a3521b9a36c28219fd6180cc7a9ce8207"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ad59bf0c5e5fbdcf729638547400310"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8ad59bf0c5e5fbdcf729638547400310"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>compute_inner_prod_tables</b> (size_t nx, const float *x, float *dis_tables) const </td></tr>
<tr class="separator:a8ad59bf0c5e5fbdcf729638547400310"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1ae7892a15b9f6809a3ba1a123a7831b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a1ae7892a15b9f6809a3ba1a123a7831b">search</a> (const float *x, size_t nx, const uint8_t *codes, const size_t ncodes, <a class="el" href="structfaiss_1_1HeapArray.html">float_maxheap_array_t</a> *res, bool init_finalize_heap=true) const </td></tr>
<tr class="separator:a1ae7892a15b9f6809a3ba1a123a7831b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a66be226806ca2abcaaf1653cdc690aa6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a66be226806ca2abcaaf1653cdc690aa6">search_ip</a> (const float *x, size_t nx, const uint8_t *codes, const size_t ncodes, <a class="el" href="structfaiss_1_1HeapArray.html">float_minheap_array_t</a> *res, bool init_finalize_heap=true) const </td></tr>
<tr class="separator:a66be226806ca2abcaaf1653cdc690aa6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a75e4ef2c5dbeb8d642bb9a6ea5fb6c06"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a75e4ef2c5dbeb8d642bb9a6ea5fb6c06"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>compute_sdc_table</b> ()</td></tr>
<tr class="separator:a75e4ef2c5dbeb8d642bb9a6ea5fb6c06"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1471cd122b4f8ca45d51a7ab86ed009b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1471cd122b4f8ca45d51a7ab86ed009b"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>search_sdc</b> (const uint8_t *qcodes, size_t nq, const uint8_t *bcodes, const size_t ncodes, <a class="el" href="structfaiss_1_1HeapArray.html">float_maxheap_array_t</a> *res, bool init_finalize_heap=true) const </td></tr>
<tr class="separator:a1471cd122b4f8ca45d51a7ab86ed009b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a567cd512438f9e3404d9339a232d7695"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a567cd512438f9e3404d9339a232d7695"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a567cd512438f9e3404d9339a232d7695">d</a></td></tr>
<tr class="memdesc:a567cd512438f9e3404d9339a232d7695"><td class="mdescLeft">&#160;</td><td class="mdescRight">size of the input vectors <br/></td></tr>
<tr class="separator:a567cd512438f9e3404d9339a232d7695"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a83600e328893ce5f41fe459f5a3acf41"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a83600e328893ce5f41fe459f5a3acf41"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a83600e328893ce5f41fe459f5a3acf41">M</a></td></tr>
<tr class="memdesc:a83600e328893ce5f41fe459f5a3acf41"><td class="mdescLeft">&#160;</td><td class="mdescRight">number of subquantizers <br/></td></tr>
<tr class="separator:a83600e328893ce5f41fe459f5a3acf41"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac920fea11f02e8407d12cc99a09f5ea5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac920fea11f02e8407d12cc99a09f5ea5"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#ac920fea11f02e8407d12cc99a09f5ea5">nbits</a></td></tr>
<tr class="memdesc:ac920fea11f02e8407d12cc99a09f5ea5"><td class="mdescLeft">&#160;</td><td class="mdescRight">number of bits per quantization index <br/></td></tr>
<tr class="separator:ac920fea11f02e8407d12cc99a09f5ea5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a467b451ca203544e42c250e4be65b983"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a467b451ca203544e42c250e4be65b983"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a467b451ca203544e42c250e4be65b983">dsub</a></td></tr>
<tr class="memdesc:a467b451ca203544e42c250e4be65b983"><td class="mdescLeft">&#160;</td><td class="mdescRight">dimensionality of each subvector <br/></td></tr>
<tr class="separator:a467b451ca203544e42c250e4be65b983"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa61330eadb84772b71018b093773a5f9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa61330eadb84772b71018b093773a5f9"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#aa61330eadb84772b71018b093773a5f9">code_size</a></td></tr>
<tr class="memdesc:aa61330eadb84772b71018b093773a5f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">byte per indexed vector <br/></td></tr>
<tr class="separator:aa61330eadb84772b71018b093773a5f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0feee45e4151547b7a0444c14bad398f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0feee45e4151547b7a0444c14bad398f"></a>
size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a0feee45e4151547b7a0444c14bad398f">ksub</a></td></tr>
<tr class="memdesc:a0feee45e4151547b7a0444c14bad398f"><td class="mdescLeft">&#160;</td><td class="mdescRight">number of centroids for each subquantizer <br/></td></tr>
<tr class="separator:a0feee45e4151547b7a0444c14bad398f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1e4056fa3938ed8c9fe701e90d94ad95"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1e4056fa3938ed8c9fe701e90d94ad95"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a1e4056fa3938ed8c9fe701e90d94ad95">verbose</a></td></tr>
<tr class="memdesc:a1e4056fa3938ed8c9fe701e90d94ad95"><td class="mdescLeft">&#160;</td><td class="mdescRight">verbose during training? <br/></td></tr>
<tr class="separator:a1e4056fa3938ed8c9fe701e90d94ad95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adc7c3cb8bcbd76e5b4b1c2e645091179"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adc7c3cb8bcbd76e5b4b1c2e645091179"></a>
<a class="el" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">train_type_t</a>&#160;</td><td class="memItemRight" valign="bottom"><b>train_type</b></td></tr>
<tr class="separator:adc7c3cb8bcbd76e5b4b1c2e645091179"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af265acf5aa1bcda60898002287e6a3d6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af265acf5aa1bcda60898002287e6a3d6"></a>
<a class="el" href="structfaiss_1_1ClusteringParameters.html">ClusteringParameters</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#af265acf5aa1bcda60898002287e6a3d6">cp</a></td></tr>
<tr class="memdesc:af265acf5aa1bcda60898002287e6a3d6"><td class="mdescLeft">&#160;</td><td class="mdescRight">parameters used during clustering <br/></td></tr>
<tr class="separator:af265acf5aa1bcda60898002287e6a3d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a62def246cfef670f2973fdf4af1414e1"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structfaiss_1_1Index.html">Index</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a62def246cfef670f2973fdf4af1414e1">assign_index</a></td></tr>
<tr class="separator:a62def246cfef670f2973fdf4af1414e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aab1109a29ba0544358e274d727b23cae"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aab1109a29ba0544358e274d727b23cae"></a>
std::vector&lt; float &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#aab1109a29ba0544358e274d727b23cae">centroids</a></td></tr>
<tr class="memdesc:aab1109a29ba0544358e274d727b23cae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Centroid table, size M * ksub * dsub. <br/></td></tr>
<tr class="separator:aab1109a29ba0544358e274d727b23cae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6bd65fb4407452f73acb7242931d09e4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6bd65fb4407452f73acb7242931d09e4"></a>
std::vector&lt; float &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1ProductQuantizer.html#a6bd65fb4407452f73acb7242931d09e4">sdc_table</a></td></tr>
<tr class="memdesc:a6bd65fb4407452f73acb7242931d09e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Symmetric Distance Table. <br/></td></tr>
<tr class="separator:a6bd65fb4407452f73acb7242931d09e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Product Quantizer. Implemented only for METRIC_L2 </p>

<p>Definition at line <a class="el" href="ProductQuantizer_8h_source.html#l00023">23</a> of file <a class="el" href="ProductQuantizer_8h_source.html">ProductQuantizer.h</a>.</p>
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a class="anchor" id="a3a41c6286095e731be744548d9535a35"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="structfaiss_1_1ProductQuantizer.html#a3a41c6286095e731be744548d9535a35">faiss::ProductQuantizer::train_type_t</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>initialization </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><em><a class="anchor" id="a3a41c6286095e731be744548d9535a35a4960d143d2aa49cf92028cf3470c47a0"></a>Train_hot_start</em>&nbsp;</td><td class="fielddoc">
<p>the centroids are already initialized </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="a3a41c6286095e731be744548d9535a35aa1aefc6c08f0ca974de9f59d9557aa0d"></a>Train_shared</em>&nbsp;</td><td class="fielddoc">
<p>share dictionary accross PQ segments </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="a3a41c6286095e731be744548d9535a35ac8040c8792a014a2ea7188583575013e"></a>Train_hypercube</em>&nbsp;</td><td class="fielddoc">
<p>intialize centroids with nbits-D hypercube </p>
</td></tr>
<tr><td class="fieldname"><em><a class="anchor" id="a3a41c6286095e731be744548d9535a35a6b330bc2cfa02a402d002d657f214931"></a>Train_hypercube_pca</em>&nbsp;</td><td class="fielddoc">
<p>intialize centroids with nbits-D hypercube </p>
</td></tr>
</table>

<p>Definition at line <a class="el" href="ProductQuantizer_8h_source.html#l00039">39</a> of file <a class="el" href="ProductQuantizer_8h_source.html">ProductQuantizer.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a95060fedd7c09eb20e968fd2fdb4b316"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::ProductQuantizer::compute_code_from_distance_table </td>
          <td>(</td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>tab</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>code</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>If we happen to have the distance tables precomputed, this is more efficient to compute the codes. </p>

<p>Definition at line <a class="el" href="ProductQuantizer_8cpp_source.html#l00406">406</a> of file <a class="el" href="ProductQuantizer_8cpp_source.html">ProductQuantizer.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="aecd05d180799f3956065b0c5c54fd406"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::ProductQuantizer::compute_codes_with_assign_index </td>
          <td>(</td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>codes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>speed up code assignment using assign_index (non-const because the index is changed) </p>

<p>Definition at line <a class="el" href="ProductQuantizer_8cpp_source.html#l00427">427</a> of file <a class="el" href="ProductQuantizer_8cpp_source.html">ProductQuantizer.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a36361f41bcd2fa698f3c39eb7111ed09"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::ProductQuantizer::compute_distance_table </td>
          <td>(</td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>dis_table</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Compute distance table for one vector.</p>
<p>The distance table for x = [x_0 x_1 .. x_(M-1)] is a M * ksub matrix that contains</p>
<p>dis_table (m, j) = || x_m - c_(m, j)||^2 for m = 0..M-1 and j = 0 .. ksub - 1</p>
<p>where c_(m, j) is the centroid no j of sub-quantizer m.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>input vector size d </td></tr>
    <tr><td class="paramname">dis_table</td><td>output table, size M * ksub </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="ProductQuantizer_8cpp_source.html#l00517">517</a> of file <a class="el" href="ProductQuantizer_8cpp_source.html">ProductQuantizer.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a3521b9a36c28219fd6180cc7a9ce8207"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::ProductQuantizer::compute_distance_tables </td>
          <td>(</td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>dis_tables</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>compute distance table for several vectors </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nx</td><td>nb of input vectors </td></tr>
    <tr><td class="paramname">x</td><td>input vector size nx * d </td></tr>
    <tr><td class="paramname">dis_table</td><td>output table, size nx * M * ksub </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="ProductQuantizer_8cpp_source.html#l00546">546</a> of file <a class="el" href="ProductQuantizer_8cpp_source.html">ProductQuantizer.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a1ae7892a15b9f6809a3ba1a123a7831b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::ProductQuantizer::search </td>
          <td>(</td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>codes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const size_t&#160;</td>
          <td class="paramname"><em>ncodes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1HeapArray.html">float_maxheap_array_t</a> *&#160;</td>
          <td class="paramname"><em>res</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>init_finalize_heap</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>perform a search (L2 distance) </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>query vectors, size nx * d </td></tr>
    <tr><td class="paramname">nx</td><td>nb of queries </td></tr>
    <tr><td class="paramname">codes</td><td>database codes, size ncodes * code_size </td></tr>
    <tr><td class="paramname">ncodes</td><td>nb of nb vectors </td></tr>
    <tr><td class="paramname">res</td><td>heap array to store results (nh == nx) </td></tr>
    <tr><td class="paramname">init_finalize_heap</td><td>initialize heap (input) and sort (output)? </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="ProductQuantizer_8cpp_source.html#l00659">659</a> of file <a class="el" href="ProductQuantizer_8cpp_source.html">ProductQuantizer.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a66be226806ca2abcaaf1653cdc690aa6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::ProductQuantizer::search_ip </td>
          <td>(</td>
          <td class="paramtype">const float *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>nx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>codes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const size_t&#160;</td>
          <td class="paramname"><em>ncodes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1HeapArray.html">float_minheap_array_t</a> *&#160;</td>
          <td class="paramname"><em>res</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>init_finalize_heap</em> = <code>true</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>same as search, but with inner product similarity </p>

<p>Definition at line <a class="el" href="ProductQuantizer_8cpp_source.html#l00674">674</a> of file <a class="el" href="ProductQuantizer_8cpp_source.html">ProductQuantizer.cpp</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a class="anchor" id="a62def246cfef670f2973fdf4af1414e1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structfaiss_1_1Index.html">Index</a>* faiss::ProductQuantizer::assign_index</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>if non-NULL, use this index for assignment (should be of size d / M) </p>

<p>Definition at line <a class="el" href="ProductQuantizer_8h_source.html#l00052">52</a> of file <a class="el" href="ProductQuantizer_8h_source.html">ProductQuantizer.h</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following files:<ul>
<li>/data/users/hoss/faiss/<a class="el" href="ProductQuantizer_8h_source.html">ProductQuantizer.h</a></li>
<li>/data/users/hoss/faiss/<a class="el" href="ProductQuantizer_8cpp_source.html">ProductQuantizer.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
